<template>
  <div id="app">
    <keep-alive>
      <router-view v-if="$route.meta.keepAlive&&isRouterAlive"></router-view>
    </keep-alive>
    <router-view v-if="!$route.meta.keepAlive&&isRouterAlive"></router-view>
  </div>
</template>

<script>
console.log(process.env.NODE_ENV, '运行模式')
export default {
  name: 'app',
  provide() {
    return {
      reload: this.reload, // 刷新优化
    }
  },
  data() {
    return {
      isRouterAlive: true,
    }
  },
  created() {},
  methods: {
    reload() {
      this.isRouterAlive = false
      this.$nextTick(function () {
        this.isRouterAlive = true
      })
    },
  },
}
</script>

